package cn.maszy.action.customer;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import net.sourceforge.stripes.action.SessionScope;
import cn.maszy.common.BaseAction;
import cn.maszy.common.Pager;
import cn.maszy.model.customer.B_T_Ufp_Maintain;
import cn.maszy.model.customer.B_T_Ufp_SellClue;
import cn.maszy.model.customer.B_T_Ufp_SellFollow;
import cn.maszy.service.customer.B_T_Ufp_MaintainService;
import cn.maszy.service.customer.B_T_Ufp_SellClueService;
import cn.maszy.service.customer.B_T_Ufp_SellFollowService;

@SessionScope
public class SellFollowAction extends BaseAction<B_T_Ufp_SellFollow> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2475349243064011153L;
	private B_T_Ufp_SellFollow B_T_Ufp_SellFollow;
	private B_T_Ufp_SellClue B_T_Ufp_SellClue;
//	private Pager<B_T_Ufp_SellFollow> pagefollow;
	@Autowired
	private B_T_Ufp_SellFollowService B_T_Ufp_SellFollowService;
	@Autowired
	private B_T_Ufp_SellClueService B_T_Ufp_SellClueService;
	@Autowired
	private B_T_Ufp_MaintainService B_T_Ufp_MaintainService;
	private List<B_T_Ufp_Maintain> list_maintain;
	private String checkIds;
	private String customerid;
	
	/*********************class set/get****************************/
	public List<B_T_Ufp_Maintain> getList_maintain() {
		return list_maintain;
	}
	public void setList_maintain(List<B_T_Ufp_Maintain> list_maintain) {
		this.list_maintain = list_maintain;
	}
	public String getCustomerid() {
		return customerid;
	}
	public void setCustomerid(String customerid) {
		this.customerid = customerid;
	}
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}
	public B_T_Ufp_SellFollow getB_T_Ufp_SellFollow() {
		return B_T_Ufp_SellFollow;
	}
	public void setB_T_Ufp_SellFollow(B_T_Ufp_SellFollow B_T_Ufp_SellFollow) {
		this.B_T_Ufp_SellFollow = B_T_Ufp_SellFollow;
	}
	
public B_T_Ufp_SellClue getB_T_Ufp_SellClue() {
		return B_T_Ufp_SellClue;
	}
	public void setB_T_Ufp_SellClue(B_T_Ufp_SellClue b_T_Ufp_SellClue) {
		B_T_Ufp_SellClue = b_T_Ufp_SellClue;
	}
	//	public Pager<B_T_Ufp_SellFollow> getPagefollow() {
//		return pagefollow;
//	}
//	public void setPagefollow(Pager<B_T_Ufp_SellFollow> pagefollow) {
//		this.pagefollow = pagefollow;
//	}
	/*******************STRUTS ACTION METHOD*************************/
	/**
	 * 页面查询
	 * @return
	 * @throws Exception
	 */
	public String sellfollowList() throws Exception {
		pager = new Pager<B_T_Ufp_SellFollow>(pageNum, numPerPage,orderField,orderDirection);
		pager= B_T_Ufp_SellFollowService.selectList(B_T_Ufp_SellFollow,pager);
		//给选项卡下标0 值
				if(B_T_Ufp_SellFollow!=null){
					B_T_Ufp_SellClue=B_T_Ufp_SellClueService.selectOne(B_T_Ufp_SellFollow.getSellclueId());
				}
		return SUCCESS;
	}
	/**
	 * 新增更新
	 * @return
	 * @throws Exception
	 */
	public String sellfollowUpdate() throws Exception {
	 
		int i	=B_T_Ufp_SellFollowService.update(B_T_Ufp_SellFollow);
		if(i>0)
			//目前只有点击提交后关闭
			//return ajaxForwardSuccess(getText("msg.operation.success"), "adminList", "closeCurrent", "investment/adminList");
		//保存不关闭暂时没做
		return ajaxForwardSuccess(getText("msg.operation.success"), "SellfollowList","", "forward", "costomer/SellfollowList?b_T_Ufp_SellFollow.sellclueId="+B_T_Ufp_SellFollow.getSellclueId());
		//新增后跳转到所属跟进记录页面
		//return ajaxForwardSuccess(getText("msg.operation.success"), "SellfollowList", "forward", "costomer/SellfollowList?b_T_Ufp_SellFollow.sellclueId="+B_T_Ufp_SellFollow.getSellclueId());
		return ajaxForwardError(getText("msg.operation.failure"));
	}
 
	/**
	 * 删除一条数据
	 * @return
	 * @throws Exception
	 */
	public String sellfollowDel() throws Exception {
		int i=B_T_Ufp_SellFollowService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "SellfollowList","", "forward", "costomer/SellfollowList?b_T_Ufp_SellFollow.sellclueId="+B_T_Ufp_SellFollow.getSellclueId());
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 查询一条数据
	 * @return
	 * @throws Exception
	 */
	public String sellfollowDetail() throws Exception {
		if(B_T_Ufp_SellFollow==null){
			B_T_Ufp_SellFollow=B_T_Ufp_SellFollowService.selectOne("");
		}
		else
		{
			if(B_T_Ufp_SellFollow.getSellclueId()==null)
			{
				B_T_Ufp_SellFollow=B_T_Ufp_SellFollowService.selectOne(B_T_Ufp_SellFollow.getUuid());
			}
		}
		list_maintain=B_T_Ufp_MaintainService.selectListchange();
		return SUCCESS;
	}
}
